package com.my.order.service.impl;

import com.my.common.domain.UserAddress;
import com.my.common.service.OrderService;
import com.my.common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 1.将服务提供者注册到注册中心（暴露服务）
 *  1）导入dubbo依赖和zookeeper客户端
 *  2）配置服务提供者
 * 2.让服务消费者去注册中心订阅服务提供者的服务地址
 */
@Service
public class OrderServiceImpl implements OrderService {

    //dubbo基本测试
    @Resource(name = "userService")
    UserService userService;

    @Override
    public void initOrder(Integer uid) {
        //1.查询用户的收货地址
        List<UserAddress> list = userService.getList(uid);
        System.out.println(list);
    }


    //测试dubbo多版本
    @Resource(name = "userServiceVersion")
    UserService userServiceVersion;

    @Override
    public void initOrderVersion(Integer uid) {
        //1.查询用户的收货地址
        List<UserAddress> list = userServiceVersion.getList(uid);
        System.out.println(list);
    }


}
